<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
  <script src="https://code.jquery.com/jquery-1.7.2.js"></script>
  <script type="text/javascript">

  	    var ACCESS_TOKEN = '',
  	        APPID = "wx2e42d039d5e586f6",
  	        APPSECRET = "45c064a2d44fead5198cd4bd12a94658";

        $(document).ready(function(){
            get_AccessToken();
        });

        //获取权限
        function get_AccessToken() {
            $.ajax({
			    type: 'GET',
			    url: 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid='+APPID+'&secret='+APPSECRET,
			    data: data,
			    success: function(data) {
                    if (data.access_token) {
                    	ACCESS_TOKEN = data.access_token;
                        init();
                    } else {
                    	alert(data.errmsg);
                    }
			    }
			});
        }

        function init() {

        }

        //获取用户基本信息（包括UnionID机制）
        function getUser() {
        	$.ajax({
			    type: 'GET',
			    url: 'https://api.weixin.qq.com/cgi-bin/user/info?access_token='+ACCESS_TOKEN+'&openid='+OPENID+'&lang=zh_CN',
			    data: data,
			    success: function(data) {
                    if (data.access_token) {
                    	AccessToken = data.access_token;
                        init();
                    } else {
                    	alert(data.errmsg);
                    }
			    }
			});
        }


  </script>
</head>
<body>
    <div>开发微信公众号测试</div>
</body>
</html>